import { EnemyManager } from '../Base/EnemyManager';
import Singleton from '../Base/Singleton';
import { ILevel, ITile } from '../Levels/index';
import { BurstManager } from '../Scripts/Burst/BurstManager';
import { DoorManager } from '../Scripts/Door/DoorManager';
import { PlayerManager } from '../Scripts/Player/PlayerManager';
import { TileManager } from '../Scripts/Scene/TileManager';
import { SpikesManager } from '../Scripts/Spikes/SpikesManager';

export type IRecord = Omit<ILevel, 'mapInfo'>;

export default class DataManager extends Singleton {
    levelIndex: number = 1;

    mapInfo: ITile[][];
    tileInfo: TileManager[][];
    mapRowCount: number;
    mapColumnCount: number;

    player: PlayerManager = null;
    enemies: EnemyManager[] = [];

    door: DoorManager = null;

    bursts: BurstManager[] = [];

    spikes: SpikesManager[] = [];

    records: IRecord[];

    static get Instance() {
        return super.GetInstance<DataManager>();
    }

    private constructor() {
        super();
        this.reset();
    }

    reset() {
        this.mapInfo = [];
        this.tileInfo = [];
        this.mapRowCount = 0;
        this.mapColumnCount = 0;

        this.enemies = [];
        this.bursts = [];
        this.spikes = [];
        this.records = [];

        this.player = null;
        this.door = null;
    }
}

